﻿/*
 * Copyright the original author or authors.
 * 
 * Licensed under the MOZILLA PUBLIC LICENSE, Version 1.1 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.mozilla.org/MPL/MPL-1.1.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import com.bourre.events.EventType;
import com.bourre.events.BasicEvent;
import com.bourre.log.PixlibStringifier;

/**
 * The {@code RTEvent} is dispatched by the {@link com.kairos.engine.RTBeacon}
 * in the {@code onEnterFrame} event.
 * 
 * <p>The {@code RTEvent} store values from the {@code RTBeacon} object. 
 * You can access those values with the {@link #getStep} and 
 * {@link #getStepInSecond} methods.</p>
 * 
 * @author	Cédric Néhémie
 * @see	com.kairos.engine.RTBeacon
 */
class com.kairos.engine.RTEvent extends BasicEvent
{
	private var _nSc : Number;
	private var _nS : Number;

	/**
	 *	Create a new {@code RTEvent} object.
	 *	
	 *	@param	e	The event type.
	 *	@param	oT	Target of the event.
	 */
	public function RTEvent ( e : EventType, oT )
	{
		super ( e, oT );
		_nSc = _nS = 0;
	}
	
	/**
	 * Return the last frame duration in milliseconds.
	 *	
	 * @return	{@code Number}
	 * @see		com.kairos.engine.RTBeacon#getStep
	 */	
	public function getStep () : Number
	{
		return _nS;
	}
	/*
	* Define the value for the {@code getStep} return value. 
	*/
	public function setStep ( n : Number ) : Void
	{
		_nS = n;
	}
	
	/**
	 * Return the last frame duration in seconds.
	 *	
	 * @return	{@code Number}
	 * @see		com.kairos.engine.RTBeacon#getStepInSecond
	 */	
	public function getStepInSecond () : Number
	{
		return _nSc;
	}
	/*
	* Define the value for the {@code getStepInSecond} return value. 
	*/
	public function setStepInSecond ( n : Number ) : Void
	{
		_nSc = n;
	}
	
	/**
	 * Return the String representation of the object.
	 */	
	public function toString() : String
	{
		return PixlibStringifier.stringify( this );
	}
}